-
-
Notifications
You must be signed in to change notification settings - Fork 4
feat: v8.2 refactoring tools improvements #126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Five features based on Cursor agent feedback from live refactoring trial: 1. Function-level complexity in auditRisk — wire tree-sitter complexity analyzer into audit, returning per-function cyclomatic+cognitive scores sorted by complexity (top 10 per file). Falls back to heuristic. 2. Graceful degradation messaging — new DegradationWarning type with capability percentages and fix commands. Wired into explore, understand, prepareChange, auditRisk, and findDeadCode MCP handlers. 3. Test gap analysis — new testgap package + analyzeTestGaps MCP tool. Cross-references complexity analysis with SCIP references or heuristic name matching to identify untested functions, sorted by risk. 4. Richer prepareChange for rename/extract — RenameDetail (call sites, type refs, imports with context snippets) and ExtractDetail (boundary analysis) added as parallel goroutines in PrepareChange. 5. Unified planRefactor compound tool — aggregates prepareChange + auditRisk + analyzeTestGaps in parallel, generates ordered refactoring steps by change type (rename/extract/delete/modify). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🟡 Change Impact Analysis
Blast Radius: 0 modules, 1 files, 147 unique callers 📝 Changed Symbols (410)
🎯 Affected Downstream (20)
Recommendations
Generated by CKB |
🔐 Security Audit Results
📦 Dependency VulnerabilitiesFound 7 vulnerability(ies) across 2 scanner(s) DetailsTrivy (4 findings)
OSV-Scanner (3 findings)
📜 License IssuesFound 144 non-permissive license(s) Details
Generated by CKB Security Audit | View Details | Security Tab |
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (11.7%) is below the target coverage (30.0%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #126 +/- ##
=========================================
- Coverage 44.9% 44.6% -0.4%
=========================================
Files 350 357 +7
Lines 60028 60690 +662
=========================================
+ Hits 27004 27081 +77
- Misses 31188 31769 +581
- Partials 1836 1840 +4
Flags with carried forward coverage won't be shown. Click here to find out more. 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
CKB Analysis
Risk factors: Medium-sized PR with 17 files • High churn: 1405 lines changed • Touches 5 hotspot(s)
🎯 Change Impact Analysis · 🟡 MEDIUM · 410 changed → 20 affected
Symbols changed in this PR:
Downstream symbols affected:
Recommendations:
💣 Blast radius · 0 symbols · 2 tests · 0 consumersTests that may break:
🔥 Hotspots · 5 volatile files
📦 Modules · 2 at risk
📊 Complexity · 7 violations
💡 Quick wins · 10 suggestions
📚 Stale docs · 143 broken references
Generated by CKB · Run details |
Summary
auditRisknow returns per-functionfunctionComplexity[]with cyclomatic+cognitive scores via tree-sitter, sorted by complexity (top 10 per file). Falls back to string-counting heuristic without CGO.DegradationWarningin the envelope when SCIP is missing (~40% capability), stale (~60%), or git is unavailable (~20%), with actionable fix commands.analyzeTestGapstool identifies untested functions sorted by complexity. Uses SCIP references when available, falls back to heuristic test file name matching. Added torefactorpreset.prepareChangenow returnsrenameDetail(classified call sites, type refs, imports with context snippets) for rename operations, andextractDetail(boundary analysis) for extract operations, via parallel goroutines.planRefactortool aggregates prepareChange + auditRisk + analyzeTestGaps in parallel, returning combined risk assessment, impact analysis, test strategy, coupling analysis, and ordered refactoring steps by change type. Added tocoreandrefactorpresets.Test plan
go build ./cmd/ckbcompiles cleango test ./internal/...— all 52 packages passgo install ./cmd/ckbinstalls updated binaryauditRiskresponse includesfunctionComplexity[]with sorted functionsexplorewith stale index → responsewarnings[]includes capability messageanalyzeTestGapson a file → returns untested functions sorted by complexityprepareChangewithchangeType: "rename"→ response includesrenameDetailplanRefactoron a file → returns combined risk + impact + tests + steps🤖 Generated with Claude Code